// JavaScript Document

var page2_css = {
	filter : function() 
	{
        var f = document.forms[0];
		f.submit();
    },
	
    deleteAll : function(start) 
	{
		var flag = false;
		var o = document.getElementsByName('uid[]');
		for(var i=0; i<o.length; i++)
		{
			if (o[i].checked) flag = true;
		}
		if (flag)
		{
			if (confirm('Delete these items?'))
			{
				var f = document.forms[0];
				f.action = SITE_URL + 'admin/page2_css.page2_css_process.deleteAll/'+start;
				f.submit();
			}
		} else
			alert('Please select items');
    },
    
    deleteOne : function(start, id)
	{
		if (confirm('Delete this item?')) 
	        document.location.href = SITE_URL + 'admin/page2_css.page2_css_process.deleteOne/'+start+'/'+id;
    },
	
	sortColumn : function(start, col)
	{
		document.location.href = SITE_URL + 'admin/page2_css.page2_css_process.sortColumn/'+start+'/'+col;
	},
	
	saveItem : function(start, id) 
	{
		// validate
        var f = document.forms[0];
		if (f.css_file.value.strip() == '')
		{
			$('css_file').focus();
			alert('Please fill name');
			return false;
		}
		f.action = SITE_URL + 'admin/page2_css.page2_css_process.saveItem/'+start+'/'+id;
		f.submit();
		return true;
    },
	
    cancel : function(start)
	{
        document.location.href = SITE_URL + 'admin/page2_css.page2_css.lists/'+start;
    }
}
